package day16_Runnable.demo09例子;

import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class Demo03_Map {
    public  void show() throws InterruptedException {
        //创建线程池
        ExecutorService pool = Executors.newFixedThreadPool(8);
        File file = new File("E:\\csw\\Demo\\a\\splitData");
        File[] files = file.listFiles();
        int flag=0;
        for (File file1 : files) {//获取切分后的小文件 8
            //创建线程对象
            MapTask mapTask = new MapTask(file1,flag);
            //启动线程
            pool.submit(mapTask);
            flag++;
        }
        //关闭线程池
        pool.shutdown();
        pool.awaitTermination(100000l,TimeUnit.SECONDS);
    }
}
